<fieldset style="background:#ffffff; border-width:thin; border-style:solid; padding:10px; border-color:#CCCCCC;">
<legend style="font-size:1.0em; font-weight: bold;">Biodata</legend>
<table class="classBackground" border="0" cellpadding="2" cellspacing="1" width="100%">
  <tbody>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>NO. KP/Passport</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_profile[no_kp]" id="master_profile_no_kp" value="<?=$master_profile->no_kp?>" onblur="" onchange="" onfocus="" onselect="" maxlength="12" size="15" type="text" />      </td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>No Fail JPN</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_staf[no_fail_jpn]" id="master_staf_no_file_jpn" value="<?=$master_staf->no_fail_jpn?>" onblur="" onchange="" onfocus="" onselect="" maxlength="100" size="50" type="text" />      </td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10">&nbsp;</td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Gelaran</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_staf[kod_gelaran]" id="master_staf[kod_gelaran]" onchange="//getAjaxParlimen();getAjaxDaerah();getAjaxPPD();">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_gelaran','id','nama');
				echo $combo->printCombo2($options, "pisang",true, "$staff->kod_gelaran",false,0);
			  ?>
      </select></td>
    </tr>

    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Nama</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_profile[nama]" id="master_profile_nama" value="<?=$master_profile->nama?>" onblur="" onchange="" onfocus="" onselect="" maxlength="100" size="50" type="text" /></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Jantina</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_profile[jantina_id]" type="radio" value="1" <? echo ($master_profile->jantina_id=='1')? "checked":"";?>/>
        Lelaki
        <input name="master_profile[jantina_id]" type="radio" value="2" <? echo ($master_profile->jantina_id=='2')? "checked":"";?>/> 
        Perempuan
  </td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Kaum</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_profile[kod_kaum]" id="master_profile[kod_kaum]">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_kaum2','kod_kaum','kaum');
				echo $combo->printCombo2($options, "",true, "$master_profile->kod_kaum",false,0);
			  ?>
      </select></td>
    </tr>
    
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>No. Telefon Bimbit</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_profile[telefon_bimbit]" id="master_profile_telefon_bimbit" value="<?=$master_profile->telefon_bimbit?>" onblur="" onchange="" onfocus="" onselect="" maxlength="" size="10" type="text" /></td></tr>
  </tbody>
</table>
</fieldset><br/>

<!-- Perkhidmatan -->
<fieldset style="background:#ffffff; border-width:thin; border-style:solid; padding:10px; border-color:#CCCCCC;">
<legend style="font-size:1.0em; font-weight: bold;">Perkhidmatan</legend>
<table class="classBackground" border="0" cellpadding="2" cellspacing="1" width="100%">
  <tbody>
    <!--tr>
      <td class="classRowLabel" align="left" valign="top">&nbsp;</td>
      <td height="20" align="left" valign="top" class="classRowLabel"><strong>Institusi (rekod PDG) </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><?=$guru_egtukar->kod_institusi_egtukar?>
      <?//=getFieldByWhereSql("master_institusi","nama","where kod='$guru_egtukar->kod_institusi_egtukar'")?></td>
    </tr-->
    
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10">&nbsp;</td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Tarikh Mula Berkhidmat</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><?//=dmy_date($master_staf->tarikh_mula_berkhidmat)?>
      <input name="master_staf[tarikh_mula_berkhidmat]" id="master_staf_tarikh_mula_berkhidmat" type="text" value="<?=dmy_date($master_staf->tarikh_mula_berkhidmat)?>" size="10" maxlength="10"/>
				<span style=" font-size:0.8em; color: orange;">(<a id="f_rangeStart_trigger2">dd-mm-yyyy</a>)</span>
                <!--button id="f_clearRangeStart" onclick="clearRangeStart()">clear</button-->
                <script type="text/javascript">
                  new Calendar({
                          inputField: "master_staf_tarikh_mula_berkhidmat",
                          dateFormat: "%d-%m-%Y",
                          trigger: "f_rangeStart_trigger2",
                          bottomBar: false,
                          onSelect: function() {
                                  var date = Calendar.intToDate(this.selection.get());
                                  LEFT_CAL.args.min = date;
                                  LEFT_CAL.redraw();
                                  this.hide();
                          }
                  });
                  function clearRangeStart() {
                          document.getElementById("f_rangeStart").value = "";
                          LEFT_CAL.args.min = null;
                          LEFT_CAL.redraw();
                  };
                </script>						  


      <input type="hidden" name="master_staf[current_institusi_id]" value="<?=$institusi->institusi_id?>"/></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Tarikh Mula Mengajar Prasekolah</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow">
	  						  <input name="master_staf[tarikh_mula_pra]" value="<?=dmy_date($master_staf->tarikh_mula_pra)?>" id="f_rangeStart" size="10" maxlength="10"/>
				<span style=" font-size:0.8em; color: orange;">(<a id="f_rangeStart_trigger">dd-mm-yyyy</a>)</span>
                <!--button id="f_clearRangeStart" onclick="clearRangeStart()">clear</button-->
                <script type="text/javascript">
                  new Calendar({
                          inputField: "f_rangeStart",
                          dateFormat: "%d-%m-%Y",
                          trigger: "f_rangeStart_trigger",
                          bottomBar: false,
                          onSelect: function() {
                                  var date = Calendar.intToDate(this.selection.get());
                                  LEFT_CAL.args.min = date;
                                  LEFT_CAL.redraw();
                                  this.hide();
                          }
                  });
                  function clearRangeStart() {
                          document.getElementById("f_rangeStart").value = "";
                          LEFT_CAL.args.min = null;
                          LEFT_CAL.redraw();
                  };
                </script>						  
    
	  
	  </td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10">&nbsp;</td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Kategori Staf</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_staf[kod_kategori]" id="master_staf_kod_kategori">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_kategori_staf','kod_kategori','kategori');
				echo $combo->printCombo2($options, "",true, "$master_staf->kod_kategori",false,0);
			  ?>
      </select></td>
    </tr>

    <tr>
      <td class="classRowLabel" align="left" valign="top">&nbsp;</td>
      <td height="20" align="left" valign="top" class="classRowLabel">&nbsp;</td>
      <td align="center" valign="top" class="classRowLabel">&nbsp;</td>
      <td class="classRow">&nbsp;</td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Pencapaian Akademik Tertinggi</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_staf[kod_akademik_tinggi]" id="select" style=" width: 200px;">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_akademik_tinggi','kod','akademiktertinggi');
				echo $combo->printCombo2($options, "",true, "$master_staf->kod_akademik_tinggi",false,0);
			  ?>
      </select>
        <?//=getFieldByWhereSql("ref_akademik_tinggi","akademiktertinggi","where kod='$master_staf->kod_akademik_tinggi'")?>
      </td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Gred Jawatan</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><?//=$master_staf->kod_gred_jawatan?>
      <input type="text" name="master_staf[kod_gred_jawatan]" value="<?=$master_staf->kod_gred_jawatan?>"/></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Taraf Jawatan</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_staf[kod_taraf_jawatan]" id="select2">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_taraf_jawatan','kod','taraf');
				echo $combo->printCombo2($options, "",true, "$master_staf->kod_taraf_jawatan",false,0);
			  ?>
      </select>
	  </td>
    </tr>

    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Opsyen</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_staf[kod_opsyen]" id="select3" style=" width:200px;">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_opsyen','kod','opsyen');
				echo $combo->printCombo2($options, "",true, "$master_staf->kod_opsyen",false,0);
			  ?>
      </select>
        <?//=getFieldByWhereSql("ref_opsyen","opsyen","where kod='$master_staf->kod_opsyen'")?>
	  </td>
    </tr>
    
    <tr>
      <td align="left" class="classRow"></td>
      <td align="left" class="classRow"></td>
      <td align="center" class="classRow"></td>
      <td class="classRow">&nbsp;</td>
    </tr>
  </tbody>
</table>
</fieldset>
<br />
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="classBackground">
  <tbody>
    <tr>
      <td class="classRow" align="center"><span class="TableRowCenter">
        <input name="button2" type="submit" class="Button" onclick="" value="Simpan" style=" width:100px;" />
        </span><span class="TableRowLeft">
          <input name="button22" type="reset" class="Button" onclick="" value="Batal" style=" width:100px;" />
        </span></td>
    </tr>
  </tbody>
</table>
<input type="hidden" name="master_staf[kod_institusi]" value="<?=$institusi->kod_institusi?>"/>
<input type="hidden" name="save" value="save"/>


<script>

function GoSubmit(df) {

	//if (!checkSelection(strRegExp,$('kod'),'Kod Institusi')) return false;
	if (!checkInput(/.*/,$('kod'),'Kod Institusi')) return false;
	if (!checkInput(/.*/,$('nama'),'Nama')) return false;
	if (!checkInput(/.*/,$('alamat'),'Alamat Institusi')) return false;

	if (!checkSelection(strRegExp,$('agensi_pelaksana_id'),'Agensi Pelaksana')) return false;
	if (!checkSelection(strRegExp,$('negeri_id'),'Negeri')) return false;
	if (!checkSelection(strRegExp,$('lokasi_id'),'Lokasi')) return false;
	if (!checkSelection(strRegExp,$('kod_daerah'),'Daerah')) return false;

	if (!checkSelection(strRegExp,$('kod_ppd'),'PPD')) return false;
	if (!checkSelection(strRegExp,$('parlimen_id'),'Parlimen')) return false;
	if (!checkSelection(strRegExp,$('dun_id'),'DUN')) return false;
	if (!checkSelection(strRegExp,$('bahasa_penghantar_id'),'Bahasa Penghantar')) return false;
	if (!checkSelection(strRegExp,$('gred_institusi_id'),'Gred Insitusi')) return false;
	if (!checkSelection(strRegExp,$('jenis_institusi_id'),'Jenis Insitusi')) return false;
	if (!checkSelection(strRegExp,$('maklumat_oku_id'),'Maklumat OKU')) return false;

	//if (!checkInput(anythingRegExp,$('profile_name'),'Nama Penuh Pemohon')) return false;
	//if (!checkInput(anything,$('profile_fax'),'Nombor Fax')) return false;

	return true;
}

</script>

<script>
function getAjaxPPD() {
	//$('select_ppd_span').innerHTML = "<font color=orange>Searching PPD...please wait</font>"
	ajax_department_request("ajax.php?act=ppds_of_negeri", "negeri_id="+$("negeri_id").value)
}

function ajax_department_request(url, data) {
    var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: data, onComplete: ajax_department_response}
    );
}

function ajax_department_response(originalRequest) {
	if (originalRequest.responseText != 0) {
		var a = originalRequest.responseText.split("$$")
		var k = new Array(a.length)
		for (i=0; i<k.length; i++) {
			k[i] = a[i].split("=")
		}
		//alert(originalRequest.responseText)
		
		str  = "<select  id=\"kod_ppd\" name=\"master_institusi[kod_ppd]\" class=\"px200\">\n";
		str += "<option value=\"\">Sila Pilih</option>\n"
		for (i=0; i<k.length; i++) {
			str += "<option value=\"" + k[i][1] + "\">" + k[i][0] + "</option>\n";
		}
		str += "</select>\n";
		$("select_ppd_span").innerHTML = str;
	}
	else {
		$('select_ppd_span').innerHTML = "<font color=orange>List not found</font>"
	}
}

function getAjaxDaerah() {
	//$('select_daerah_span').innerHTML = "<font color=orange>Searching Daerah...please wait</font>"
	ajax_daerah_request("ajax.php?act=daerahs_of_negeri", "negeri_id="+$("negeri_id").value)
}

function ajax_daerah_request(url, data) {
    var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: data, onComplete: ajax_daerah_response}
    );
}

function ajax_daerah_response(originalRequest) {
	if (originalRequest.responseText != 0) {
		var a = originalRequest.responseText.split("$$")
		var k = new Array(a.length)
		for (i=0; i<k.length; i++) {
			k[i] = a[i].split("=")
		}
		//alert(originalRequest.responseText)
		
		str  = "<select  id=\"kod_daerah\" name=\"master_institusi[kod_daerah]\" class=\"px200\">\n";
		str += "<option value=\"\">Sila Pilih</option>\n"
		for (i=0; i<k.length; i++) {
			str += "<option value=\"" + k[i][1] + "\">" + k[i][0] + "</option>\n";
		}
		str += "</select>\n";
		$("select_daerah_span").innerHTML = str;
	}
	else {
		$('select_daerah_span').innerHTML = "<font color=orange>List not found</font>"
	}
}


function getAjaxParlimen() {
	//$('select_parlimen_span').innerHTML = "<font color=orange>Searching Parlimen...please wait</font>"
	ajax_parlimen_request("ajax.php?act=parlimens_of_negeri", "negeri_id="+$("negeri_id").value)
}

function ajax_parlimen_request(url, data) {
    var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: data, onComplete: ajax_parlimen_response}
    );
}

function ajax_parlimen_response(originalRequest) {
	if (originalRequest.responseText != 0) {
		var a = originalRequest.responseText.split("$$")
		var k = new Array(a.length)
		for (i=0; i<k.length; i++) {
			k[i] = a[i].split("=")
		}
		//alert(originalRequest.responseText)
		
		str  = "<select  id=\"parlimen_id\" name=\"master_institusi[parlimen_id]\" class=\"px200\" onchange=\"getAjaxDun()\">\n";
		str += "<option value=\"\">Sila Pilih</option>\n"
		for (i=0; i<k.length; i++) {
			str += "<option value=\"" + k[i][1] + "\">" + k[i][0] + "</option>\n";
		}
		str += "</select>\n";
		$("select_parlimen_span").innerHTML = str;
	}
	else {
		$('select_parlimen_span').innerHTML = "<font color=orange>List not found</font>"
	}
}

function getAjaxDun() {
	//$('select_parlimen_span').innerHTML = "<font color=orange>Searching Parlimen...please wait</font>"
	ajax_dun_request("ajax.php?act=duns_of_parlimen", "parlimen_id="+$("parlimen_id").value)
}

function ajax_dun_request(url, data) {
    var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: data, onComplete: ajax_dun_response}
    );
}

function ajax_dun_response(originalRequest) {
	if (originalRequest.responseText != 0) {
		var a = originalRequest.responseText.split("$$")
		var k = new Array(a.length)
		for (i=0; i<k.length; i++) {
			k[i] = a[i].split("=")
		}
		//alert(originalRequest.responseText)
		
		str  = "<select  id=\"dun_id\" name=\"master_institusi[dun_id]\" class=\"px200\">\n";
		str += "<option value=\"\">Sila Pilih</option>\n"
		for (i=0; i<k.length; i++) {
			str += "<option value=\"" + k[i][1] + "\">" + k[i][0] + "</option>\n";
		}
		str += "</select>\n";
		$("select_dun_span").innerHTML = str;
	}
	else {
		$('select_dun_span').innerHTML = "<font color=orange>List not found</font>"
	}
}

</script>

          <div id="cont" style=" display:none"></div>
          <script type="text/javascript">
            var LEFT_CAL = Calendar.setup({
                    cont: "cont",
                    weekNumbers: true,
                    selectionType: Calendar.SEL_MULTIPLE,
                    showTime: 12
                    // titleFormat: "%B %Y"
            })
          </script>
